JBoss Community Archive (Read Only)

Scribble

Implement the Module

Each module will be different, and therefore discussing
specific implementation details will not be possible.

However validation modules will tend to access the complete
model, but possibly only be interested in certain parts
of it. Therefore usually the validation modules will
define an implementation of the
org.scribble.protocol.model.Visitor interface.

In the example validator, there is a SimpleValidatorVisitor
class that is derived from the DefaultVisitor,
and only overrides the method to accept an interaction. Therefore only
validation of interactions is of interest to this validator. In this
particular case, the validator is checking the message types, and reporting
an error if a particular value is detected.

The actual main class within the validator module would
implement the org.scribble.protocol.validation.ProtocolValidator
interface.

There may also exist specialised implementations of the
ProtocolValidator interface that help support
the validation process. For example, the
ProtocolComponentValidator which triggers
a ProtocolComponentValidatorRule based on the
type of the model component. The visitor is used to traverse
the model to identify the model components being validated.
So its possible, if validation of only a couple of model
component types is required (as in the simple validator),
to derive a specialisation of the
ProtocolComponentValidator class with
the relevant rule implementations.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 09:37:58 UTC, last content change 2011-05-24 08:36:16 UTC.